package com.szxy.lockdemo;

/**
 * @Author: zwz
 * @Date:2020/10/23 18:08
 * @Description:
 **/
public class NoReentrantLockDemo {
    private boolean isLocked = false;

    public synchronized void lock() throws InterruptedException {
        while(isLocked) {
            wait();
        }
        isLocked = true;
    }

    public synchronized void unlock() {
        isLocked = false;
        notify();
    }
}
